package main.com.smartagriculture.model;
import java.text.SimpleDateFormat;
import java.util.Date;

public class FarmingMachine {
    private String type;
    private String name;
    private String location;
    private double fuelLevel;
    private String operationStatus;
    private long createdTime;

    public FarmingMachine(String type) {
        this.type = type;
    }

    public FarmingMachine(String type, String name, long createdTime, String location, double fuelLevel, String operationStatus) {
        this.type = type;
        this.name = name;
        this.createdTime = createdTime;
        this.location = location;
        this.fuelLevel = fuelLevel;
        this.operationStatus = operationStatus;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public double getFuelLevel() {
        return fuelLevel;
    }

    public void setFuelLevel(double fuelLevel) {
        this.fuelLevel = fuelLevel;
    }

    public String getOperationStatus() {
        return operationStatus;
    }

    public void setOperationStatus(String operationStatus) {
        this.operationStatus = operationStatus;
    }

    public long getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(long createdTime) {
        this.createdTime = createdTime;
    }

    public String getFormattedCreatedTime() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(new Date(createdTime));
    }

    @Override
    public String toString() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String formattedTime = sdf.format(new Date(createdTime));
        return "FarmingMachine{" +
                "类型='" + type + '\'' +
                ", 名称='" + name + '\'' +
                ", 创建时间=" + formattedTime +
                ", 位置='" + location + '\'' +
                ", 油量=" + fuelLevel +
                ", 设备状态='" + operationStatus + '\'' +
                '}';
    }
}